<%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>

<div class="block">
    
    <div class="block_head">
        <div class="bheadl"></div>
        <div class="bheadr"></div>
        <h2>Details of flat "<bean:write name="flat" property="flatName"/>"</h2>
    </div>
    <!-- .block_head ends -->
    
    <div class="block_content clearfix">
        
        <logic:notEmpty name="errorMessages" >
            <div class="message errormsg">
                <logic:iterate id="message" name="errorMessages">
                    <p><bean:write name="message"/></p>
                </logic:iterate>
            </div>
        </logic:notEmpty>
        <logic:notEmpty name="successMessages" >
            <div class="message success">
                <logic:iterate id="message" name="successMessages">
                    <p><bean:write name="message"/></p>
                </logic:iterate>
            </div>
        </logic:notEmpty>
        <h2>Building</h2><br/>
        <p>
            <label>ID: </label>
            <span class="text"><bean:write name="building" property="buildingID"/></span>
        </p>
        <p>
            <label>Building Name: </label>
            <span class="text"><bean:write name="building" property="buildingName"/></span>
        </p>
        <p>
            <label>Building Type </label>
            <span class="text"><bean:write name="building" property="typeName"/></span>
        </p>
        <p>
            <label>Number of floors: </label>
            <span class="text"><bean:write name="building" property="numFloors"/></span>
        </p>
        <p>
            <label>Number of rooms: </label>
            <span class="text"><bean:write name="building" property="numFloors"/></span>
        </p>
        <p>
            <label>Constructed On: </label>
            <span class="text"><fmt:formatDate type="date" value="${building.constructedDate}"/></span>
        </p>
        <hr/>
        <br/><br/>
        <h2>Flat</h2><br/>
        <p>
            <label>ID: </label>
            <span class="text"><bean:write name="flat" property="flatID"/></span>
        </p>
        <p>
            <label>Flat Name: </label>
            <span class="text"><bean:write name="flat" property="flatName"/></span>
        </p>
        <p>
            <label>Floor Number: </label>
            <span class="text"><bean:write name="flat" property="floorNumber"/></span>
        </p>
        <p>
            <label>Area: </label>
            <span class="text"><bean:write name="flat" property="area"/>
            &nbsp;sq.foot</span>
        </p>
        <p>
            <label>Cost: </label>
            <span class="text"><fmt:formatNumber value="${flat.cost}"/>
                &nbsp;U.S. dollars</span>
        </p>
        <p><label>Description:</label></p>
        <div>
            ${building.description}
        </div>
        <hr/>
        
        <html:form styleId="flatForm" action="admin/flat.do" method="post">
            <p>
                <html:hidden property="flatID" />
                <html:submit property="action" value="Edit" styleClass="submit"/>
                <html:link styleClass="confirm-button submit small red" action="/admin/flatListing.do?action=delete" paramId="flatID" paramName="flatForm" paramProperty="flatID">
                    Delete
                </html:link>
                <html:link action="/admin/flatListing.do" styleClass="submit long gray">Back to the list</html:link>
            </p>
        </html:form>
        
        
    </div>
    <!-- .block_content ends -->
    
    <div class="bendl"></div>
    <div class="bendr"></div>
    
</div>
<!-- .block ends -->
